package com.shawn.integeration.common.exception;

import com.shawn.integeration.common.model.res.GenericResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常处理器
 *
 * @author: shawn
 * @Date: 2023/12/28 11:07
 * @Version 1.0.0
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {


    @ExceptionHandler(Exception.class)
    public GenericResponse handleException(Exception e) {
        log.error(e.getMessage(),e);
        return GenericResponse.error("服务器内部错误,请联系管理员");
    }
}
